/**
 @file ctc_stacking.h

 @author  Copyright (C) 2011 Centec Networks Inc.  All rights reserved.

 @date 2009-11-11

 @version v2.0

   This file contains all stacking related data structure, enum, macro and proto.
*/

#ifndef _CTC_STK_H
#define _CTC_STK_H
#ifdef __cplusplus
extern "C" {
#endif

#include "ctc_const.h"
#include "ctc_packet.h"
/****************************************************************
*
* Defines and Macros
*
****************************************************************/

#define CTC_STK_MAX_TRUNK_ID  127
#define CTC_STK_TRUNK_BMP_NUM   ((CTC_STK_MAX_TRUNK_ID + CTC_UINT32_BITS) / CTC_UINT32_BITS)
/**
 @defgroup stacking STACKING
 @{
*/

/**
 @brief  define stacking trunk load balance mode
*/
enum ctc_stacking_load_mode_e
{
    CTC_STK_LOAD_STATIC,          /**< [GB.GG.D2.TM.TMM.AT]stacking uplink trunk use static load balance by packetHash%trunkMembers */
    CTC_STK_LOAD_DYNAMIC,         /**< [GB.GG.D2.TM.TMM.AT]stacking uplink trunk use dynamic load balance by monitor traffic from the trunk member */
    CTC_STK_LOAD_STATIC_FAILOVER, /**< [GB.GG.D2.TM.TMM.AT]stacking uplink trunk use failover to automatic switch to other member when member is linkdown */
    CTC_STK_LOAD_MODE_MAX
};
typedef enum ctc_stacking_load_mode_e ctc_stacking_load_mode_t;

/**
 @brief  define stacking trunk cloud header type
*/
enum ctc_stacking_hdr_flag_e
{
    CTC_STK_HDR_WITH_NONE,        /**< [GB.GG.D2.TM.TMM.AT]stacking without cloud header*/
    CTC_STK_HDR_WITH_L2,          /**< [GB.GG.D2.TM.TMM.AT]stacking with L2 cloud header*/
    CTC_STK_HDR_WITH_L2_AND_IPV4, /**< [GB.GG.D2]stacking with L2 + IPv4 cloud header*/
    CTC_STK_HDR_WITH_L2_AND_IPV6, /**< [GB.GG.D2]stacking with L2 + IPv6 cloud header*/
    CTC_STK_HDR_WITH_IPV4,        /**< [GB.GG.D2]stacking with IPv4 cloud header*/
    CTC_STK_HDR_WITH_IPV6         /**< [GB.GG.D2]stacking with IPv6 cloud header*/
};
typedef enum ctc_stacking_hdr_flag_e ctc_stacking_hdr_flag_t;

/**
 @brief  define stacking port configuration data struct
*/
struct ctc_stacking_port_cfg_s
{
    uint32  gport;                         /**< [D2.TM.TMM.AT] Gport */
    uint8   direction;                     /**< [D2.TM.TMM.AT] direction, refer to ctc_direction_t*/
    uint8   hdr_type;                      /**< [D2.TM.TMM.AT] encap cloud header type, refer to ctc_stacking_hdr_flag_t*/
    uint8   enable;                        /**< [D2.TM.TMM.AT] 0:diable stacking port property, 1: enable stacking port property */
    uint8   rsv;
};
typedef struct ctc_stacking_port_cfg_s ctc_stacking_port_cfg_t;

/**
 @brief  define stacking property value
*/
enum ctc_stacking_prop_type_e
{
    CTC_STK_PROP_GLOBAL_CONFIG,           /**< [GB.GG.D2.TM.TMM.AT]set stacking global confiure, p_value, point to ctc_stacking_glb_cfg_t*/
    CTC_STK_PROP_MCAST_STOP_RCHIP,        /**< [GB.GG.D2.TM.TMM.AT]set mcast stop , p_value, point to ctc_stacking_stop_rchip_t*/
    CTC_STK_PROP_BREAK_EN,                /**< [GB.GG.D2.TM.TMM.AT]if stacking exist break point, set enable(value = 1) or disable(value = 0)*/
    CTC_STK_PROP_FULL_MESH_EN,            /**< [GB.GG.D2.TM.TMM.AT]if stacking topo is fullmesh, set enable(value = 1) or disable(value = 0)*/
    CTC_STK_PROP_MCAST_BREAK_POINT,       /**< [GB.GG.D2.TM.TMM.AT]Set mcast break point, use for ring topo, p_value, point to ctc_stacking_mcast_break_point_t*/
    CTC_STK_PROP_PORT_BIND_TRUNK,         /**< [GB.GG.D2.TM.TMM.AT] Port bind trunk which used for trunk check, p_value, point to ctc_stacking_bind_trunk_t*/
    CTC_STK_PROP_RCHIP_PORT_EN,           /**< [GB.GG.D2.TM.TMM.AT]Remote chip ability, p_value, point to ctc_stacking_rchip_port_t*/
    CTC_STK_PROP_STK_PORT_EN,             /**< [D2.TM.TMM.AT] Set stacking port enable, refer to ctc_stacking_port_cfg_t*/
    CTC_STK_PROP_LB_HASH_OFFSET,          /**< [TM.TMM.AT] stacking load balance hash offset, p_value, point to ctc_stacking_lb_hash_offset_t */
    CTC_STK_PROP_MAX
};
typedef enum ctc_stacking_prop_type_e ctc_stacking_prop_type_t;

/**
 @brief  define stacking cloud header global configure
*/
struct ctc_stacking_hdr_glb_s
{
    uint8  mac_da_chk_en;      /**< [GB.GG.D2.TM.TMM.AT]if set, cloud header packet mac da field with be check against port mac or system mac(default: 0)*/
    uint8  ether_type_chk_en;  /**< [GB.GG.D2.TM.TMM.AT]if set, cloud header packet ether_type field with be check against ether_type(default: 0) */
    uint8  cos;                /**< [GB.GG.D2.TM.TMM.AT]cloud header vlan cos if exist vlan(default: 7)*/
    uint8  ip_protocol;        /**< [GB.GG.D2]cloud header ip protocol if exist ip header, (default: 255)*/

    uint16 vlan_tpid;          /**< [GB.GG.D2.TM.TMM.AT]cloud header vlan tpid(default: 0x8100)*/
    uint16 ether_type;         /**< [GB.GG.D2.TM.TMM.AT]cloud header ether type(default: 0x55bb)*/

    uint8  ip_ttl;             /**< [GB.GG.D2]cloud header ip ttl if exist ip header, (default: 255)*/
    uint8  ip_dscp;            /**< [GB.GG.D2]cloud header ip dscp if exist ip header, (default: 63)*/
    uint8  udp_en;             /**< [GB.GG.D2]cloud header encap with udp header(default: 0)*/
    uint8  is_ipv4;            /**< [GB.GG.D2]cloud header encap with ipv4 or ipv6(default: 1)*/

    union
    {
        ip_addr_t ipv4;             /**< [GB.GG.D2]cloud header ipv4 sourec address(default: 0)*/
        ipv6_addr_t ipv6;           /**< [GB.GG.D2]cloud header ipv6 sourec address(default: 0,0,0,0)*/
    } ipsa;

    uint16 udp_src_port;            /**< [GB.GG.D2]cloud header udp source port if udp_en(default: 0)*/
    uint16 udp_dest_port;           /**< [GB.GG.D2]cloud header udp destination port if udp_en(default: 0)*/
};
typedef struct ctc_stacking_hdr_glb_s ctc_stacking_hdr_glb_t;


/**
@brief  define stacking fabric global configure
*/
struct ctc_stacking_inter_connect_glb_s
{
    #define CTC_INTER_CONNECT_MEMBER_NUM  4                                   /**< [GB]inter connect member num*/
    uint8  mode;                                                              /**< [GB] Two-Chips inter-connect. 0, stacking mode; 1 interlaken mode*/
    uint16  member_port[CTC_MAX_LOCAL_DEV_NUM][CTC_INTER_CONNECT_MEMBER_NUM];/**< [GB] Member Port is valid for stacking mode, Port is lport*/
    uint8  member_num;                                                        /**< [GB] Member port num for stacking mode, max is CTC_STACKING_MEMBER_NUM*/
};
typedef struct ctc_stacking_inter_connect_glb_s ctc_stacking_inter_connect_glb_t;


/**
 @brief  define stacking version
*/
enum ctc_stacking_version_e
{
    CTC_STACKING_VERSION_1_0,     /**< [D2.TM.TMM.AT] The Version, stackingHeader's length is 32. GB GG and D2 all support the version 1.0*/
    CTC_STACKING_VERSION_2_0,     /**< [D2.TM.TMM.AT] The Version, stackingHeader's length is flexible. D2 Support the version 2.0*/
};
typedef enum ctc_stacking_version_e ctc_stacking_version_t;



enum ctc_stacking_trunk_mode_e
{
    CTC_STACKING_TRUNK_MODE_0 = 0,/**< [GB.GG.D2.TM.TMM.AT] Only support Static mode, trunk max member count is 8, support one port belong to two group*/
    CTC_STACKING_TRUNK_MODE_1,    /**< [GB.GG.D2.TM.TMM.AT] Support Static/DLB mode, Static max member count is 32, TM/TMM/AT is 31, DLB max member count is 16, support one port belong to two group*/
    CTC_STACKING_TRUNK_MODE_2,    /**< [GB.GG.D2.TM.TMM.AT] Support Static/DLB mode, Static max member count is <1-32>, For TM max is 31, TMM/AT max is 15,  DLB max member count is 16, max trunk group 64*/
    CTC_STACKING_TRUNK_MODE_3,    /**< [TMM.AT] Support Static/DLB mode, Static max member count is <1-31>, For AT, max is 63,  DLB max member count is 16*/
    CTC_STACKING_TRUNK_MODE_4,    /**< [AT] Support Static/DLB mode, Static max member count is <1-7>, max trunk group 127, support one port belong to two group*/
    CTC_STACKING_TRUNK_MODE_5,    /**< [AT] Support Static/DLB mode, Static max member count is <1-63>, DLB max member count is 16, max trunk group 16, support one port belong to two group*/
    CTC_STACKING_TRUNK_MODE_6,    /**< [AT] Support Static/DLB mode, Static max member count is <1-127>, DLB max member count is 16, max trunk group 8, support one port belong to two group*/
    CTC_STACKING_TRUNK_MODE_MAX
};
typedef enum ctc_stacking_trunk_mode_e ctc_stacking_trunk_mode_t;

enum ctc_stacking_learning_mode_e
{
    CTC_STK_LEARNING_MODE_BY_STK_HDR,         /**< [D2.TM.TMM.AT] Learning by stacking header*/
    CTC_STK_LEARNING_MODE_BY_PKT,             /**< [D2.TM.TMM.AT] Learning by re-parser packet, only for basic L2 forwarding*/
    CTC_STK_LEARNING_MODE_NONE                /**< [D2.TM.TMM.AT] Don't learning for no-first chip*/
};
typedef enum ctc_stacking_learning_mode_e ctc_stacking_learning_mode_t;
/**
 @brief  define stacking global configure
*/
struct ctc_stacking_glb_cfg_s
{
    ctc_stacking_hdr_glb_t hdr_glb;                 /**< [GB.GG.D2.TM.TMM.AT]cloud header global configure*/
    ctc_stacking_inter_connect_glb_t connect_glb;   /**< [GB]Two-Chips inter-connect global configure*/
    uint8  fabric_mode;                             /**< [GG.D2.TM.TMM.AT]the fabric mode of distributed system, 0:normal mode; 1:spine-leaf mode(default: 0)*/
    uint8  trunk_mode;                              /**< [GG.D2.TM.TMM.AT]The stacking global trunk mode, refer to ctc_stacking_trunk_mode_t(default: 0)*/
    uint8  version;                                 /**< [D2.TM.TMM.AT] stacking version, refer to ctc_stacking_version_t(default: 0)*/
    uint8  mcast_mode;                              /**< [GB.GG.D2.TM.TMM.AT] Mcast mode, 0:add trunk to mcast group automatically; 1:add trunk to mcast group by user(default: 0)*/
    uint8  learning_mode;                           /**< [D2.TM.TMM.AT] Learning mode, refer to ctc_stacking_learning_mode_t(default: CTC_STK_LEARNING_MODE_NONE)*/
    uint8  src_port_mode;                           /**< [D2.TM.TMM.AT] 0: use src gport+remote chip to select ucast path, 1: use forward select group id+remote chip to select ucast path
                                                                        2: use remote chip 3: use src gport lb hash to select ucast path(default: 0)*/
    uint16  max_gchip_id;                           /**< [D2.TM.TMM.AT] The max gchip id that this chip can support, if set 0 means max gchip id is 127*/
    uint16  max_block_port_id;                      /**< [D2.TM.TMM.AT] Used for the stop mode of CTC_STK_STOP_MODE_BLOCK_RCHIP_PORT,if set 0 means 63 before TM.MX but 127 from TM.MX*/
};
typedef struct ctc_stacking_glb_cfg_s ctc_stacking_glb_cfg_t;

/**
 @brief  define stacking cloud header data structure
*/
struct ctc_stacking_hdr_encap_s
{
    uint32 hdr_flag;   /**< [GB.GG.D2.TM.TMM.AT]encap cloud header type, refer to ctc_stacking_hdr_flag_t*/

    mac_addr_t mac_da; /**< [GB.GG.D2.TM.TMM.AT]cloud header mac da if exist l2 header*/
    mac_addr_t mac_sa; /**< [GB.GG.D2.TM.TMM.AT]cloud header mac sa if exist l2 header*/

    uint8  vlan_valid; /**< [GB.GG.D2.TM.TMM.AT]if set, cloud header will encap vlan when using l2 header*/
    uint8  rsv;
    uint16 vlan_id;   /**< [GB.GG.D2.TM.TMM.AT]cloud header vlan id if exist vlan */

    union
    {
        ip_addr_t ipv4;             /**< [GB.GG.D2]cloud header ipv4 destination address*/
        ipv6_addr_t ipv6;           /**< [GB.GG.D2]cloud header ipv6 destination address*/
    } ipda;

};
typedef struct ctc_stacking_hdr_encap_s ctc_stacking_hdr_encap_t;

/**
 @brief  define stacking extend mode data structure
*/
struct ctc_stacking_extend_s
{
    uint8  gchip;          /**< [GB.GG.D2.TM.TMM]local gchip id, only useful when enable extend mode*/
    uint8  enable;         /**< [GB.GG.D2.TM.TMM]use gchip for extend mode*/
};
typedef struct ctc_stacking_extend_s ctc_stacking_extend_t;

enum ctc_stacking_trunk_flag_e
{
    CTC_STACKING_TRUNK_MEM_ASCEND_ORDER = 0x00000001,    /**< [GB.GG.D2.TM.TMM.AT] if set, the member port will be in order,only support in static mode*/
    CTC_STACKING_TRUNK_LB_HASH_OFFSET_VALID = 0x00000002, /**< [TM.TMM.AT] load hash offset is high priority */
    CTC_STACKING_TRUNK_LSH = 0x00000004                  /**< [TMM.AT]* link self healing enable*/
};
typedef enum ctc_stacking_trunk_flag_e ctc_stacking_trunk_flag_t;

/**
 @brief  define stacking trunk (uplink) data structure
*/
struct ctc_stacking_trunk_s
{
    uint8               trunk_id;             /**< [GB.GG.D2.TM.TMM.AT]uplink trunk id */
    /*trunk*/
    uint8               lb_hash_offset;       /**< [TM.TMM.AT] select load balance hash offset*/
    uint16              max_mem_cnt;          /**< [GB.GG.D2.TM.TMM.AT] trunk group max member count
                                                    not support  trunk_mode == CTC_STACKING_TRUNK_MODE_0/1 */
    uint32              flag;                 /**< [GB.GG.D2.TM.TMM.AT] trunk flag, refer to ctc_stacking_trunk_flag_t; */

    /*trunk member*/
    uint32              gport;                /**< [GB.GG.D2.TM.TMM.AT]uplink trunk member port used for load balance*/

    /*trunk remote gchip*/
    uint8               select_mode;          /**< [D2.TM.TMM.AT] unicast path select mode, If set 1,  use src port and remote chip select path, else use remote chip select path*/
    uint8               remote_gchip;         /**< [GB.GG.D2.TM.TMM.AT]remote gchip id from uplink trunk id, used for ucast path select. 
                                                                        When src_port_mode=3, src_gport=CTC_MAX_UINT32_VALUE,remote chip id is hash value*/
    uint16              rsv;
    uint32              src_gport;            /**< [D2.TM.TMM.AT]      packet in port, used for ucast path select when select_mode == 1*/

    ctc_stacking_load_mode_t     load_mode;   /**< [GB.GG.D2.TM.TMM.AT]uplink load banlance mode*/
    ctc_stacking_hdr_encap_t     encap_hdr;   /**< [GB.GG.D2.TM.TMM.AT]uplink cloud heade, config with trunk or trunk gport*/
    ctc_stacking_extend_t        extend;      /**< [GB.GG.D2.TM.TMM]useful when internal is stacking connect*/
};
typedef struct ctc_stacking_trunk_s ctc_stacking_trunk_t;

/**
 @brief  define stacking keeplive member type
*/
enum ctc_stacking_keeplive_member_type_e
{
    CTC_STK_KEEPLIVE_MEMBER_TRUNK,           /**< [GB.GG.D2.TM.TMM.AT]keepLive member is trunk(path select)*/
    CTC_STK_KEEPLIVE_MEMBER_PORT,            /**< [GB.GG.D2.TM.TMM.AT]keepLive member is gport(master cpu port)*/
    CTC_STK_KEEPLIVE_MEMBER_MCAST_PROFILE,   /**< [TM.TMM.AT]keepLive member is mcast profile*/
    CTC_STK_KEEPLIVE_MEMBER_MAX
};
typedef enum ctc_stacking_keeplive_member_type_e ctc_stacking_keeplive_member_type_t;

/**
 @brief  define stacking keeplive group data structure
*/
struct ctc_stacking_keeplive_s
{
    uint16 group_id;      /**< [GB.GG.D2.TM.TMM.AT] keeplive group id*/
    uint8  mem_type;      /**< [GB.GG.D2.TM.TMM.AT] keeplive member type, refer to ctc_stacking_keeplive_member_type_t*/
    uint8  trunk_id;      /**< [GB.GG.D2.TM.TMM.AT] uplink trunk id <1-127>, select one path which keeplive packet go through*/
    uint32 cpu_gport;     /**< [GB.GG.D2.TM.TMM.AT] assign the master cpu port which need receive the keeplive packet*/

    ctc_stacking_extend_t extend; /**< [GB.GG.D2.TM.TMM] useful when internal is stacking connect*/
    uint32 trunk_bitmap[CTC_STK_TRUNK_BMP_NUM];  /**< [GB.GG.D2.TM.TMM.AT] trunk id bitmap. If the mem_type is CTC_STK_KEEPLIVE_MEMBER_MCAST_PROFILE,
                                                  indicate it is the mcast profile id*/
    uint8  trunk_bmp_en;                         /**< [GB.GG.D2.TM.TMM.AT] if set, means using trunk_bitmap[CTC_STK_TRUNK_BMP_NUM]*/
    uint8  rsv[3];
};
typedef struct ctc_stacking_keeplive_s ctc_stacking_keeplive_t;



/**
 @brief  define stacking keeplive member type
*/
enum ctc_stacking_mcast_profile_type_e
{
    CTC_STK_MCAST_PROFILE_CREATE,           /**< [GB.GG.D2.TM.TMM.AT]create mcast profile id*/
    CTC_STK_MCAST_PROFILE_DESTROY,          /**< [GB.GG.D2.TM.TMM.AT]destroy mcast profile id*/
    CTC_STK_MCAST_PROFILE_ADD,              /**< [GB.GG.D2.TM.TMM.AT]add mcast profile member*/
    CTC_STK_MCAST_PROFILE_REMOVE,           /**< [GB.GG.D2.TM.TMM.AT]remove mcast profile member*/
    CTC_STK_MCAST_PROFILE_ADD_WITH_NH,      /**< [TM.TMM.AT]add mcast profile member with nh*/
    CTC_STK_MCAST_PROFILE_REMOVE_WITH_NH,   /**< [TM.TMM.AT]remove mcast profile member with nh*/
    CTC_STK_MCAST_PROFILE_MAX
};
typedef enum ctc_stacking_mcast_profile_type_e ctc_stacking_mcast_profile_type_t;

/**
 @brief  define stacking keeplive group data structure
*/
struct ctc_stacking_trunk_mcast_profile_s
{
    uint8  type;                  /**< [GB.GG.D2.TM.TMM.AT] operation type, refer to ctc_stacking_mcast_profile_type_t*/
    uint8  append_en;             /**< [GB.GG.D2.TM.TMM.AT] if append_en == 1, mcast_profile_id will append to default profile
                                                  else  replace default profile*/
    uint16 mcast_profile_id;      /**< [GB.GG.D2.TM.TMM.AT] Trunk mcast profile id, if mcast_profile_id == 0, SDK will alloc*/
    uint32 trunk_bitmap[CTC_STK_TRUNK_BMP_NUM];       /**< [GB.GG.D2.TM.TMM] uplink trunk id bitmap. trunk_bitmap[0] means nh_id 
                                                       when use CTC_STK_MCAST_PROFILE_ADD_WITH_NH or CTC_STK_MCAST_PROFILE_REMOVE_WITH_NH */
    ctc_stacking_extend_t extend; /**< [GB.GG.D2.TM.TMM] used in multi-chip*/

};
typedef struct ctc_stacking_trunk_mcast_profile_s ctc_stacking_trunk_mcast_profile_t;


/**
 @brief  define stacking keeplive member type
*/
enum ctc_stacking_stop_mode_e
{
    CTC_STK_STOP_MODE_DISCARD_RCHIP_BITMAP = 0,   /**< [GB.GG.D2.TM.TMM.AT] discard packets from remote chip bitmap, only support 32 chip, compatible mode*/
    CTC_STK_STOP_MODE_DISCARD_RCHIP,              /**< [D2.TM.TMM.AT] discard packets from remote chip*/
    CTC_STK_STOP_MODE_DISCARD_RCHIP_PORT,         /**< [D2.TM.TMM.AT] discard packets from a given packet in port and remote chip*/
    CTC_STK_STOP_MODE_BLOCK_RCHIP_PORT,           /**< [D2.TM.TMM.AT] block or allow packets from a given packet in port and remote chip to ports*/
    CTC_STK_STOP_MODE_MAX
};
typedef enum ctc_stacking_stop_mode_e ctc_stacking_stop_mode_t;


/**
 @brief  define stacking mcast stop remote chip configure
*/
struct ctc_stacking_stop_rchip_s
{
    uint8 mode;                                /**<[GB.GG.D2.TM.TMM.AT] ctc_stacking_stop_mode_t */
    uint32 rchip_bitmap;                       /**<[GB.GG.D2.TM.TMM.AT] remote chip bitmap, use in mode CTC_STK_STOP_MODE_DISCARD_RCHIP_BITMAP*/

    uint32 rchip;                              /**<[D2.TM.TMM.AT] remote gchip id,  used in mode CTC_STK_STOP_MODE_DISCARD_RCHIP*/
	uint32 src_gport;                          /**<[D2.TM.TMM.AT] packet in port,   used in mode CTC_STK_STOP_MODE_DISCARD_RCHIP_PORT and CTC_STK_STOP_MODE_BLOCK_RCHIP_PORT*/

    ctc_port_bitmap_t pbm;                     /**<[D2.TM.TMM.AT] bitmap port to block or allow packets from a given packet in port and remote chip, used in mode CTC_STK_STOP_MODE_BLOCK_RCHIP_PORT*/

	uint8 discard;                             /**<[D2.TM.TMM.AT] If set , discard packets from a given packet in port and remote chip, used in mode CTC_STK_STOP_MODE_DISCARD_RCHIP and CTC_STK_STOP_MODE_DISCARD_RCHIP_PORT*/

};
typedef struct ctc_stacking_stop_rchip_s ctc_stacking_stop_rchip_t;



/**
 @brief  define stacking mcast break point configure
*/
struct ctc_stacking_mcast_break_point_s
{
    uint8  trunk_id;                        /**<[GB.GG.D2.TM.TMM.AT] Trunk id to set point*/
    uint8  enable;                          /**<[GB.GG.D2.TM.TMM.AT] If set, trunk port will disable mcast transmit, else enable*/
};
typedef struct ctc_stacking_mcast_break_point_s ctc_stacking_mcast_break_point_t;

/**
 @brief  define stacking remote chip ability
*/
struct ctc_stacking_rchip_port_s
{
    uint8  rchip;                        /**<[GB.GG.D2.TM.TMM.AT] Remote  gchip id*/
    ctc_port_bitmap_t pbm;               /**<[GB.GG.D2.TM.TMM.AT] Remote chip support port bitmap*/
};
typedef struct ctc_stacking_rchip_port_s ctc_stacking_rchip_port_t;

/**
 @brief  define stacking bind trunk
*/
struct ctc_stacking_bind_trunk_s
{
    uint32  gport;                        /**<[GB.GG.D2.TM.TMM.AT] Trunk port*/
    uint8   trunk_id;                     /**<[GB.GG.D2.TM.TMM.AT] Trunk id, trunk_id = 0 means unbinding*/
    uint8   rsv[3];
};
typedef struct ctc_stacking_bind_trunk_s ctc_stacking_bind_trunk_t;


/**
 @brief  define stacking bind trunk
*/
struct ctc_stacking_lb_hash_offset_s
{
    uint8   trunk_id;                     /**<[TM.TMM.AT] Trunk id to set lb hash offset*/
    uint8   rsv[3];
    uint32  value;                        /**<[TM.TMM.AT] lb hash value */
};
typedef struct ctc_stacking_lb_hash_offset_s ctc_stacking_lb_hash_offset_t;

/**
 @brief  define stacking property data structure
*/
struct ctc_stacking_property_s
{
    uint32 prop_type;           /**< [GB.GG.D2.TM.TMM.AT] configure property type , refer to ctc_stacking_prop_type_t*/
    uint32 value;               /**< [GB.GG.D2.TM.TMM.AT] configure property value*/
    void*  p_value;             /**< [GB.GG.D2.TM.TMM.AT] configure property complex value*/

	ctc_stacking_extend_t extend;    /**<[GB.GG.D2.TM.TMM useful when internal is stacking connect*/

};
typedef struct ctc_stacking_property_s ctc_stacking_property_t;

/**
 @brief  define cloud header encap data structure
*/
struct ctc_stacking_cloud_hdr_s
{
  ctc_stacking_hdr_encap_t  hdr;    /**< [GB] Cloud header encap, only support CTC_STK_HDR_WITH_L2 */
  uint16    dest_group_id;          /**< [GB] Cloud header encap, dest mcast group id */
  uint32    dest_gport;             /**< [GB] Cloud header encap, dest gport */
  uint32    src_gchip:8;            /**< [GB] Cloud header encap, source gchip id */
  uint32    priority :8;            /**< [GB] Cloud header encap, packet priority */
  uint32    is_mcast :1;            /**< [GB] Indicate dest is mcast group */
  uint32    rsv1     :15;

  ctc_pkt_skb_t          skb;       /**< [GB] Packet TX buffer for cloud header encap */
};
typedef struct ctc_stacking_cloud_hdr_s ctc_stacking_cloud_hdr_t;

/**@} end of @defgroup  stacking STACKING */

#ifdef __cplusplus
}
#endif

#endif

